package com.glsc.ngateway.common.xir.repo;

import com.glsc.ngateway.common.xir.domain.TtrdSetInstructionSecu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TtrdSetInstructionSecuRepository extends JpaRepository<TtrdSetInstructionSecu, String>, JpaSpecificationExecutor<TtrdSetInstructionSecu> {

    List<TtrdSetInstructionSecu> findAllByInstIdInAndBiztypeIn(List<String> instIdList, List<String> biztypeList);

    @Query(value = "select * from XIR_TRD.TTRD_SET_INSTRUCTION_SECU where 1=1 " +
            "and (coalesce(:codeList, null) is null or I_CODE  in (:codeList)) " +
            "", nativeQuery = true)
    List<TtrdSetInstructionSecu> findAllByICodeIn(@Param("codeList") List<String> codeList);
}